b771ef
@@ -21,6 +21,8 @@
  */
 package org.jboss.as.clustering.jgroups.subsystem;
 
+import java.util.function.UnaryOperator;
+
 import org.jboss.as.clustering.controller.ChildResourceDefinition;
 import org.jboss.as.clustering.controller.Operations;
 import org.jboss.as.clustering.controller.SimpleAttribute;
@@ -41,11 +43,14 @@
import org.jboss.as.controller.PathAddress;
 import org.jboss.as.controller.PathElement;
 import org.jboss.as.controller.SimpleAttributeDefinition;
 import org.jboss.as.controller.SimpleAttributeDefinitionBuilder;
+import org.jboss.as.controller.SimpleOperationDefinitionBuilder;
 import org.jboss.as.controller.descriptions.ModelDescriptionConstants;
 import org.jboss.as.controller.logging.ControllerLogger;
 import org.jboss.as.controller.operations.global.MapOperations;
 import org.jboss.as.controller.registry.AttributeAccess;
+import org.jboss.as.controller.registry.ImmutableManagementResourceRegistration;
 import org.jboss.as.controller.registry.ManagementResourceRegistration;
+import org.jboss.as.controller.registry.OperationEntry;
 import org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder;
 import org.jboss.dmr.ModelNode;
 import org.jboss.dmr.ModelType;
@@ -95,6 +100,23 @@
public class PropertyResourceDefinition extends ChildResourceDefinition<Manageme
         }
     };
 
+    private static final UnaryOperator<OperationStepHandler> LEGACY_PROTOCOL_OPERATION_TRANSFORMATION = handler -> {
+        return (context, operation) -> {
+            PathAddress address = context.getCurrentAddress();
+            PathAddress protocolAddress = address.getParent();
+            PathElement legacyProtocolPath = GenericProtocolResourceDefinition.pathElement(protocolAddress.getLastElement().getValue());
+            // Use legacy protocol path in address, if one was registered
+            ImmutableManagementResourceRegistration legacyProtocolRegistration = context.getResourceRegistration().getParent().getParent().getSubModel(PathAddress.pathAddress(legacyProtocolPath));
+            if ((legacyProtocolRegistration != null) && !legacyProtocolRegistration.getPathAddress().getLastElement().isWildcard()) {
+                PathAddress genericAddress = protocolAddress.getParent().append(legacyProtocolPath).append(address.getLastElement());
+                Operations.setPathAddress(operation, genericAddress);
+                context.addStep(operation, handler, context.getCurrentStage());
+            } else {
+                handler.execute(context, operation);
+            }
+        };
+    };
+
     PropertyResourceDefinition() {
         super(WILDCARD_PATH, new JGroupsResourceDescriptionResolver(WILDCARD_PATH));
         this.setDeprecated(JGroupsModel.VERSION_3_0_0.getVersion());
@@ -117,7 +139,7 @@
public class PropertyResourceDefinition extends ChildResourceDefinition<Manageme
                 context.addStep(putOperation, MapOperations.MAP_PUT_HANDLER, context.getCurrentStage());
             }
         };
-        this.registerAddOperation(registration, addHandler);
+        registration.registerOperationHandler(new SimpleOperationDefinitionBuilder(ModelDescriptionConstants.ADD, this.getResourceDescriptionResolver()).addParameter(VALUE).withFlag(OperationEntry.Flag.RESTART_NONE).build(), LEGACY_PROTOCOL_OPERATION_TRANSFORMATION.apply(addHandler));
 
         // Delegate remove of property to "properties" attribute of parent protocol
         AbstractRemoveStepHandler removeHandler = new AbstractRemoveStepHandler() {
@@ -131,7 +153,7 @@
public class PropertyResourceDefinition extends ChildResourceDefinition<Manageme
                 context.addStep(putOperation, MapOperations.MAP_REMOVE_HANDLER, context.getCurrentStage());
             }
         };
-        this.registerRemoveOperation(registration, removeHandler);
+        registration.registerOperationHandler(new SimpleOperationDefinitionBuilder(ModelDescriptionConstants.REMOVE, this.getResourceDescriptionResolver()).withFlag(OperationEntry.Flag.RESTART_RESOURCE_SERVICES).build(), LEGACY_PROTOCOL_OPERATION_TRANSFORMATION.apply(removeHandler));
 
         // Delegate read of property value to "properties" attribute of parent protocol
         OperationStepHandler readHandler = new OperationStepHandler() {
@@ -156,7 +178,7 @@
public class PropertyResourceDefinition extends ChildResourceDefinition<Manageme
                 context.addStep(putOperation, MapOperations.MAP_PUT_HANDLER, context.getCurrentStage());
             }
         };
-        registration.registerReadWriteAttribute(VALUE, readHandler, writeHandler);
+        registration.registerReadWriteAttribute(VALUE, LEGACY_PROTOCOL_OPERATION_TRANSFORMATION.apply(readHandler), LEGACY_PROTOCOL_OPERATION_TRANSFORMATION.apply(writeHandler));
     }
 
     static void operationDeprecated(OperationContext context, ModelNode operation) {
